package edu.gmu.middleware;

import java.io.IOException;
import java.nio.ByteBuffer;

/**
 * The Unmarshaler object will take a byte[] and
 * unmarshal it into a Message.  The unmarshaling expects the header
 * and will unmarshal it first before the body of the Message.
 * 
 * @author  James H. Pope
 * @version $Revision:$ $Date:$
 */
public interface Unmarshaler
{
    /**
     * Unmarshals the specified input using the specified header 
     * into a Message object.  The specific type of payload in 
     * the message object is determined by the registration type.
     * @param header
     * @param in
     * @param messageBinding
     * @return message
     * @throws IOException if the unmashaling process was not successful
     * @throws IllegalStateException if no binding for id in registry
     */
    public Message unmarshal(   Header header,
                                ByteBuffer in,
                                MessageBinding messageBinding ) throws IOException;
}
